<?php

    #-------------------------------------------------------------#
	# This file is part of the Tekuna MVC Microframework for PHP. #
	# (c) 2009 Niels Jäckel <niels.jaeckel@tekuna.org>            #
	# Please visit http://tekuna.org/ for more information.       #
	#                                                             #
	# This software is licensed under the MIT License. Please     #
	# view the LICENSE file for the full text of this license.    #
    #-------------------------------------------------------------#


	Tekuna :: load('org.tekuna.core.filter.TekunaFilter');


	/**
	 * Converts all file endings in the given string to the Unix style (LF only).
	 * The Windows style (CRLF) and the old Mac OS style (CR) are handled.
	 */

	class UnixLineDelimitersFilter implements TekunaFilter {


		/**
		 * The filter method converts the line endings
		 */

		public function filter($mInput) {

			// change the line delimiters
			$mInput = str_replace("\r\n", "\n", $mInput);
			$mInput = str_replace("\r", "\n", $mInput);

			// return the modified file
			return $mInput;
		}
	}
